/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import interfaces.InternationalizableEntity;
import interfaces.InternationalizableEntityDescription;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "job_position_description")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "JobPositionDescription.findAll", query = "SELECT j FROM JobPositionDescription j"),
    @NamedQuery(name = "JobPositionDescription.findByIdJobPositionDescription", query = "SELECT j FROM JobPositionDescription j WHERE j.idJobPositionDescription = :idJobPositionDescription"),
    @NamedQuery(name = "JobPositionDescription.findByDescription", query = "SELECT j FROM JobPositionDescription j WHERE j.description = :description")})
public class JobPositionDescription implements Serializable, InternationalizableEntityDescription {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_JOB_POSITION_DESCRIPTION")
    private Integer idJobPositionDescription;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "DESCRIPTION")
    private String description;
    @JoinColumn(name = "JOB_POSITION", referencedColumnName = "ID_JOB_POSITION")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private JobPosition jobPosition;
    @JoinColumn(name = "LANGUAGE", referencedColumnName = "ID_LANGUAGE")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Language language;

    public JobPositionDescription() {
    }

    public JobPositionDescription(Integer idJobPositionDescription) {
        this.idJobPositionDescription = idJobPositionDescription;
    }

    public JobPositionDescription(Integer idJobPositionDescription, String description) {
        this.idJobPositionDescription = idJobPositionDescription;
        this.description = description;
    }

    public Integer getIdJobPositionDescription() {
        return idJobPositionDescription;
    }

    public void setIdJobPositionDescription(Integer idJobPositionDescription) {
        this.idJobPositionDescription = idJobPositionDescription;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public JobPosition getJobPosition() {
        return jobPosition;
    }

    public void setJobPosition(JobPosition jobPosition) {
        this.jobPosition = jobPosition;
    }

    public Language getLanguage() {
        return language;
    }

    public void setLanguage(Language language) {
        this.language = language;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idJobPositionDescription != null ? idJobPositionDescription.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JobPositionDescription)) {
            return false;
        }
        JobPositionDescription other = (JobPositionDescription) object;
        if ((this.idJobPositionDescription == null && other.idJobPositionDescription != null) || (this.idJobPositionDescription != null && !this.idJobPositionDescription.equals(other.idJobPositionDescription))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.JobPositionDescription[ idJobPositionDescription=" + idJobPositionDescription + " ]";
    }

    @Override
    public InternationalizableEntity getEntity() {
        return getJobPosition();
    }
    
}
